package Test;

import DB.ConnectionDB;

import java.sql.Connection;

import static org.junit.Assert.fail;

public class ConnectionDBTest {
    //OK
    @org.junit.Test
    public void testGetInstance() throws Exception {

        ConnectionDB dbConn = ConnectionDB.getInstance();

        if(dbConn != null) {
            System.out.println("Connecting to database - SUCCESS");
        }
        else {
            fail("Failed connecting to the database");
        }
    }
    //????
    @org.junit.Test
    public void testCloseConnection() throws Exception {
        ConnectionDB.closeConnection();

    }

    @org.junit.Test
    public void testStartTransaction() throws Exception {
       ConnectionDB.startTransaction();
    }

    @org.junit.Test
    public void testCommitTransaction() throws Exception {
        ConnectionDB.commitTransaction();
    }

    @org.junit.Test
    public void testRollbackTransaction() throws Exception {
        ConnectionDB.rollbackTransaction();
    }
}
